

// interface MyResponse {
//   code: number;
//   data: any;
//   message? : string;
// }


const FetchTxtAsText = async (url:string) =>{
  const resp = await fetch(url);

  if(!resp.ok) {
    const error: any = new Error("get file error");
    error.name = 'respError';
    error.info = { 
      code: resp.status,
      data: null,
      message:"get file error"
    };
    // console.debug(JSON.stringify(error));
    throw error;
  }
  
  const text = await resp.text();
  return text;
}